CSharpTest.Net
ContainsKey Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTree<TKey,TValue> Class : ContainsKey Method

key

Glossary Item Box

Determines whether the IDictionary contains an element with the specified key.

Syntax

Visual Basic (Declaration) 
Public Function ContainsKey( _
   ByVal key As TKey _
) As Boolean
C# 
public bool ContainsKey( 
   TKey key
)

Parameters

key

Example

BPlusTree/BPlusTree.Test/BasicTestsVersion2.cs

C#Copy Code
using (BPlusTree<int, string> tree = Create(Options))
{
    tree.EnableCount();
    Assert.AreEqual(0, tree.Count);
    tree.Rollback();
    Assert.AreEqual(0, tree.Count);
    tree.Commit();
    Assert.AreEqual(0, tree.Count);

    tree.Add(1, "A");
    tree.Rollback();
    Assert.AreEqual(0, tree.Count);
    tree.Commit();
    Assert.AreEqual(0, tree.Count);

    tree.Add(1, "A");
    tree.Commit();
    Assert.AreEqual(1, tree.Count);
    tree.Rollback();
    Assert.AreEqual(1, tree.Count);

    tree.Add(2, "B");
    tree.Rollback();
    Assert.AreEqual(1, tree.Count);
    tree[1] = "abc";
    tree.Commit();
    Assert.AreEqual(1, tree.Count);
    tree.Rollback();

    Assert.AreEqual("abc", tree[1]);
    Assert.IsFalse(tree.ContainsKey(2));
}
VB.NETCopy Code
Using tree As BPlusTree(Of Integer, String) = Create(Options)
    tree.EnableCount()
    Assert.AreEqual(0, tree.Count)
    tree.Rollback()
    Assert.AreEqual(0, tree.Count)
    tree.Commit()
    Assert.AreEqual(0, tree.Count)

    tree.Add(1, "A")
    tree.Rollback()
    Assert.AreEqual(0, tree.Count)
    tree.Commit()
    Assert.AreEqual(0, tree.Count)

    tree.Add(1, "A")
    tree.Commit()
    Assert.AreEqual(1, tree.Count)
    tree.Rollback()
    Assert.AreEqual(1, tree.Count)

    tree.Add(2, "B")
    tree.Rollback()
    Assert.AreEqual(1, tree.Count)
    tree(1) = "abc"
    tree.Commit()
    Assert.AreEqual(1, tree.Count)
    tree.Rollback()

    Assert.AreEqual("abc", tree(1))
    Assert.IsFalse(tree.ContainsKey(2))
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys